﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_CRD_BATCH_Crd4010b_Get_List_For_Verify')
	BEGIN
		DROP Procedure usp_UPDMS_CRD_BATCH_Crd4010b_Get_List_For_Verify
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_CRD_BATCH_Crd4010b_Get_List_For_Verify
**	Desc : 검증을 위한 카드사용내역 조회
**	Test Exec Query : Exec usp_UPDMS_CRD_BATCH_Crd4010b_Get_List_For_Verify 'CC07X', '2011-03-10'
**	Called by : Crd_Dac_UPDMS_CRD_BATCH_Crd4010b.cs
**	Program ID : Crd4010b
**	Auth : 송시명
**	Date : 2011-03-03
*******************************************************************************
**	Change History 
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_CRD_BATCH_Crd4010b_Get_List_For_Verify]
@ls_card_cd nvarchar(5),
@ls_paymnt_dt nvarchar(10),
@ls_lang_set nvarchar(2)
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET NOCOUNT ON

SELECT Biz_Dt,
       Div,
       Account,
       Contents,
       Amount
  FROM ( --일시불,현금 목록
         SELECT Biz_Dt,
                '일시불' AS Div,
                Account,
                Contents,
                Amount
           FROM UPDMS_CRD_ITEM_BIZ WITH(NOLOCK)
          WHERE Card_Cd = @ls_card_cd
            AND Paymnt_Dt = @ls_paymnt_dt
       --할부목록
	   UNION ALL
       SELECT b.Biz_Dt,
              '할부',
              Account,
              b.Contents,
              a.Ins_Month_Amt
         FROM UPDMS_CRD_INSTALLMENT_REPAY AS a WITH(NOLOCK)
         JOIN UPDMS_CRD_INSTALLMENT_BIZ AS b WITH(NOLOCK) ON a.Ins_Cd = b.Ins_Cd
        WHERE a.Card_Cd = @ls_card_cd
          AND a.Paymnt_Dt = @ls_paymnt_dt
       ) z
 ORDER BY z.Div, z.Biz_Dt

GO